/*
 * lab10p3.c
 * CSIS 248 Lab #10
 */

#include <stdio.h>
#include <stdlib.h>

struct MyStructure{
   int  id;
   char group;
   double balance;
};

typedef struct MyStructure Account;

struct BiStructure{
   int district;
   struct MyStructure account;
};

int main() {
   struct MyStructure x;
   x.id = 7;
   x.group = 'A';
   x.balance = 100.0;

   printf( "x has:\n  id = %d\n  group = %c\n  and balance = %5.2f\n",
                   x.id, x.group, x.balance);

   struct MyStructure club[10];
   struct MyStructure* px = &x;

//   struct MyStructure* qx = (struct MyStructure*) malloc( sizeof( struct MyStructure ));
   Account* qx = (Account*) malloc( sizeof( Account ));
   qx->id = x.id+1;
   qx->group = x.group+1;
   qx->balance = x.balance+10;

   printf( "qx points to a structure with:\n  id = %d\n  group = %c\n  and balance = %5.2f\n",
                   qx->id, qx->group, qx->balance);
   free( qx );
   return 0;
}
